	function addRows(){
		openDialog("add.act","添加");
		//showDialog();
	}
	
	function openDialog(url,title){
		parent.layer.open({
		      type: 2,
		      background:'#fff',
		      title: title,
		      shadeClose: false,
		      shade: [0.7,'#000'],
		      maxmin: true, //开启最大化最小化按钮
		      area: ['60%', '80%'],
		      content: getCurrentUrl(url)
		   });
	}
	
	function editRows(tableID){
		tableID = "#"+tableID+"Table";
    	var rows = $(tableID).bootstrapTable("getSelections");
    	if(!rows || rows.length == 0){
    		showDialog({
	            title: "提示",
	            text: "请选择要编辑的数据！",
	            type: "warning",
	        });
    	}else if(rows.length > 1 ){
    		showDialog({
	            title: "提示",
	            text: "只能选择一条记录！",
	            type: "warning",
	        });
    	}else{
    		var config = $(tableID).bootstrapTable("getOptions");
    		openDialog("edit.act?"+config.uniqueId+"="+rows[0][config.uniqueId],"编辑");
    	}
	}
	
	
	function deleteRows(tableID){
		tableID = "#"+tableID+"Table";
    	var rows = $(tableID).bootstrapTable("getSelections");
    	if(!rows || rows.length == 0){
    		showDialog({
	            title: "提示",
	            text: "请选择要删除的数据！",
	            type: "warning",
	        });
    		return;
    	}
    	showDialog({
            title: "您确定要删除这"+rows.length+"条数据吗",
            text: "删除后将无法恢复，请谨慎操作！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            onConfirm:function(){
            	doDelete(tableID);
            }
        });
	}
	
	function doDelete(tableID){
		var rows = $(tableID).bootstrapTable("getSelections");
		var config = $(tableID).bootstrapTable("getOptions");
		var ids = "";
		var uniqueIds = [];
		var temp;
		for(var index = 0;index < rows.length;index++){
			temp = rows[index][config.uniqueId];
			ids += temp+",";
			uniqueIds.push(temp);
		}
		ids = ids.substring(0,ids.length-1);
		$.ajax({
			url:getCurrentUrl("delete.act"),
			method:"post",
			data:{
				ids:ids
			},
			dataType:"json",
			onSuccess:function(json){
				if(json.statusCode == 0){
					parent.swal("删除成功！", rows.length+"条信息删除成功。", "success");
					$(tableID).bootstrapTable("remove",{"field": config.uniqueId, "values": uniqueIds})
				}
			}
		});
	}